<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    // 2.1.2 如果 regexp 带有 g 标记，则它将所有匹配项的数组作为字符串返回，而不包含分组和其他详细信息
    var str = "I love JavaScript and JavaScript";
    var result = str.match(/Java(Script)/g);
    console.log('=====2.1.2=====');
    console.log(result);
    console.log(result[0]); // JavaScript
    console.log(result.length); // 1
</script>
</body>
</html>